from flask import Blueprint, render_template, redirect

from util.LoginUtil import get_login_info

admin_index = Blueprint('admin_index', __name__)
admin_index.url_prefix = '/admin'


@admin_index.route('/')
def index():
    login_info = get_login_info()
    is_admin = login_info['user']['is_admin']
    if is_admin == 1:
        return render_template('admin/index.html')
    else:
        return redirect('/view/articles/1')


@admin_index.route('/test1')
def index12():
    return render_template('admin/article-manage.html')


@admin_index.route('/test')
def index13():
    return render_template('admin/edit/test_image.html')
